<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>用户列表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="/woniu/Public/X-admin/css/x-admin.css" media="all">
        <style type="text/css">
            .well{
                background-color:#F2F2F2;
                border:1px #ccc solid;
                border-radius:5px;
                padding:20px;
                margin: 10px;
            }
            .ys{
                margin:10px;
                height:40px;
            }
        </style>
    </head>
    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
        </div>
        <div class="x-body">
            <div style="font-size:20px;">
                <span>班级:</span><b><?php echo ($arr['name']); ?></b>
            </div>
            <hr>
        	<button class="layui-btn layui-btn-small" onclick="admin_add('添加小组','/woniu/index.php/Home/Classmanage/addteam/class/<?php echo ($arr['id']); ?>','400','300')"><i class="layui-icon"></i>添加小组</button>
			 <a class="layui-btn layui-btn-small" href="/woniu/index.php/Home/Classmanage/preInfo/id/<?php echo ($arr['id']); ?>">班学员详细信息</a>
             <a class="layui-btn layui-btn-small" href="/woniu/index.php/Home/Classmanage/MailList/id/<?php echo ($arr['id']); ?>">查看通讯录</a>
             <a class="layui-btn layui-btn-small" href="/woniu/index.php/Home/Classmanage/Excels/id/<?php echo ($arr['id']); ?>">导出保险数据</a>
            <table class="layui-table">

                    <tr>
                        <th>分组</th>
                        <td colspan='7'>
                            <?php if(is_array($teams)): foreach($teams as $key=>$rows): ?><a class="layui-btn layui-btn-small layui-btn-normal" href="javascript:;"><?php echo ($rows['name']); ?></a><?php endforeach; endif; ?>
                        </td>
                    </tr>

                    <tr>
                        <th>班主任</th>
                        <td><?php echo ($arr['admin']); ?></td>
                        <th>讲师</th>
                        <td><?php echo ($arr['teacher']); ?></td>
                        <th>项目经理</th>
                        <td><?php echo ($arr['pm']); ?></td>
                        <th>班长</th>
                        <td><?php echo ($arr['monitorname']); ?></td>
                    </tr>

                     <tr>
                        <th>专业</th>
                        <td><?php echo ($arr['major']); ?></td>
                        <th>班级状态</th>
                        <td><?php if($arr['status'] == 0): ?>即将开班 <?php elseif($arr['status'] == 1): ?>正常上课 <?php else: ?>已毕业<?php endif; ?></td>
                        <th>所在教室</th>
                        <td><?php echo ($arr['classroom']); ?></td>
                        <th>开学时间</th>
                        <td><?php echo ($arr['start']); ?></td>
                    </tr>
                   
            </table>
            <div class='well'>
                <?php if(is_array($teams)): foreach($teams as $key=>$rows): ?><div class="well"> 
                        <span>组名：</span>
                        <a class="layui-btn layui-btn-small layui-btn-normal" href="javascript:;" onclick="admin_edit('修改','/woniu/index.php/Home/Classmanage/doedit/id/<?php echo ($rows['id']); ?>','4','400','300')" style="text-decoration:none"><?php echo ($rows['name']); ?></a>
                        
                        <div rid="9" tid="<?php echo ($rows['id']); ?>" class="ys droppable ui-droppable"> 
                            <span>组长：</span>
                            <?php if(is_array($list1)): foreach($list1 as $key=>$row): if($row['role_id'] == 9 and $row['team'] == $rows['id']): ?><a uid="<?php echo ($row['id']); ?>" yid="<?php echo ($row['role_id']); ?>" class="draggable ui-draggable layui-btn layui-btn-small" href="javascript:;" style="position: relative;"><?php echo ($row['name']); ?></a><?php endif; endforeach; endif; ?>
                        </div>
                        
                        <div rid="10"  tid="<?php echo ($rows['id']); ?>" class="ys droppable ui-droppable"> 
                            <span>组员：</span>
                            <?php if(is_array($list1)): foreach($list1 as $key=>$row): if($row['team'] == $rows['id'] and $row['role_id'] != 9): ?><a uid="<?php echo ($row['id']); ?>" yid="<?php echo ($row['role_id']); ?>" class="draggable ui-draggable layui-btn layui-btn-small" href="javascript:;" style="position: relative;"><?php echo ($row['name']); ?></a><?php endif; endforeach; endif; ?>
                        </div>
                    </div><?php endforeach; endif; ?>

                <div tid="0" rid='0' class="well droppable ui-droppable"> 
                    <b class="layui-btn layui-btn-small layui-btn-normal">未分组</b>
                    <?php if(is_array($names)): foreach($names as $key=>$row): ?><a uid="<?php echo ($row['uid']); ?>" yid="<?php echo ($row['roleid']); ?>" class="draggable ui-draggable layui-btn layui-btn-small" href="javascript:;" style="position: relative;" ><?php echo ($row['name']); ?></a><?php endforeach; endif; ?>
                </div>
                
            </div>
        </div>


        <script src="/woniu/Public/js/jquery-1.8.3.min.js"></script>
        <script src="/woniu/Public/js/jquery.ui.core.js"></script>
        <script src="/woniu/Public/js/jquery.ui.widget.js"></script>
        <script src="/woniu/Public/js/jquery.ui.mouse.js"></script>
        <script src="/woniu/Public/js/jquery.ui.draggable.js"></script>
        <script src="/woniu/Public/js/jquery.ui.droppable.js"></script>
        <script src="/woniu/Public/X-admin/lib/layui/layui.js" charset="utf-8"></script>
        <script src="/woniu/Public/X-admin/js/x-layui.js" charset="utf-8"></script>
        <script>
            layui.use(['laydate','element','laypage','layer','form'], function(){
              $ = layui.jquery;//jquery
              laydate = layui.laydate;//日期插件
              lement = layui.element();//面包导航
              laypage = layui.laypage;//分页
              layer = layui.layer;//弹出层
              var form = layui.form(); //只有执行了这一步，部分表单元素才会修饰成功
 
              
            });
            // 刷新页面
            function reload(){
                location.replace(location.href);
            }
            
             /*添加*/
            function admin_add(title,url,w,h){
                x_admin_show(title,url,w,h);
            };
            
            //编辑
            function admin_edit(title,url,id,w,h) {
                x_admin_show(title,url,w,h); 
            };
           
            //拖拽学生换组
            $(function() {
                $( ".draggable" ).draggable({ revert: true , distance: 30});
                $( ".droppable" ).droppable({drop: function( event, ui ) {
                        $( this ).find( "p" ).html( "Dropped!" );
                        var uid=ui.helper.attr('uid');
                        var tid=$(this).attr('tid');
                        var rid=$(this).attr('rid');
                        var yid=ui.helper.attr('yid');
                        ui.helper.appendTo($(this));
                        $.get('/woniu/index.php/Home/Classmanage/tedit',{'uid':uid,'tid':tid,'rid':rid,'yid':yid},function(data){
                            // alert(data);
                            if(data=='0'){
                                 alert('小组调整失败，请稍后再试');
                            }
                        });
                    }
                });
            });
        </script>
            
    </body>
</html>